// 引入axios
import axios from 'axios'
// 设置基本路径接口
axios.defaults.baseURL = 'http://localhost:8888/api'
// 新闻列表页面
export const getNewsList = () => axios.get('/getnewslist').then(res => res.data)
// 新闻详情
export const getNewsDetail = id => axios.get(`/getnew/${id}`).then(res => res.data)
// 获取评论数据
export const getCommentList = (id, pageIndex) => axios.get(`/getcomments/${id}?pageindex=${pageIndex}`).then(res => res.data)
// 发表评论
export const getComContentPost = (id, content) => axios.post(`/postcomment/${id}`, content).then(res => res.data)
// 获取图片列表头部nav
export const getImgsNav = () => axios.get('/getimgcategory').then(res => res.data)

// 根据分类id获取图片列表
export const getImgsList = (id) => axios.get(`/getimages/${id}`).then(res => res.data)

// 图文详情缩略图 及 商品列表详情轮播图
export const getThumb = (id) => axios.get(`/getthumimages/${id}`).then(res => res.data)
// 获取缩略图描述
export const getSmallInfo = (id) => axios.get(`/getimageInfo/${id}`).then(res => res.data)
// 获取商品详情图片
export const getGoodsList = (pageIndwx) => axios(`/getgoods?pageindex=${pageIndwx}`).then(res => res.data)
// 获取商品价格及描述
export const getgoodsinfo = (id) => axios.get(`/goods/getinfo/${id}`).then(res => res.data)
// 获取商品购物车数据
export const getShopInfo = (id) => axios.get(`/goods/getshopcarlist/${id}`).then(res => res.data)
